import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit, QVBoxLayout


class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        # 创建文本输入框
        self.lineEdit = QLineEdit()
        self.lineEdit.setPlaceholderText("请输入内容:")

        layout = QVBoxLayout()
        layout.addWidget(self.lineEdit)
        self.setLayout(layout)

        self.setWindowTitle("text line edit")
        self.setGeometry(300, 300, 300, 200)
        self.show()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
